package com.byb.server.service.mapper;

import com.byb.server.domain.*;
import com.byb.server.service.dto.OtherSafeguard2ndDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity OtherSafeguard2nd and its DTO OtherSafeguard2ndDTO.
 */
@Mapper(componentModel = "spring", uses = {OtherSafeguardMapper.class, ProductMapper.class, })
public interface OtherSafeguard2ndMapper extends EntityMapper <OtherSafeguard2ndDTO, OtherSafeguard2nd> {

    @Mapping(source = "otherSafeguard.id", target = "otherSafeguardId")

    @Mapping(source = "product.id", target = "productId")
    OtherSafeguard2ndDTO toDto(OtherSafeguard2nd otherSafeguard2nd); 

    @Mapping(source = "otherSafeguardId", target = "otherSafeguard")

    @Mapping(source = "productId", target = "product")
    OtherSafeguard2nd toEntity(OtherSafeguard2ndDTO otherSafeguard2ndDTO); 
    default OtherSafeguard2nd fromId(Long id) {
        if (id == null) {
            return null;
        }
        OtherSafeguard2nd otherSafeguard2nd = new OtherSafeguard2nd();
        otherSafeguard2nd.setId(id);
        return otherSafeguard2nd;
    }
}
